<template>
  <a-card :bordered="false">
    <a-steps class="steps" :current="currentTab">
      <a-step title="填写提现信息" />
      <a-step title="确认提现信息" />
      <a-step title="完成" />
    </a-steps>
    <div class="content">
      <step1 v-if="currentTab === 0" @nextStep="nextStep" />
      <step2
        v-if="currentTab === 1"
        @nextStep="nextStep"
        :form-data="formData"
        @prevStep="prevStep"
      />
      <step3 v-if="currentTab === 2" @prevStep="prevStep" :form-data="formData" @finish="finish" />
    </div>
  </a-card>
</template>

<script>
import Step1 from './withDrawStep/Step01'
import Step2 from './withDrawStep/Step02'
import Step3 from './withDrawStep/Step03'

export default {
  name: 'StepForm',
  components: {
    Step1,
    Step2,
    Step3
  },
  data() {
    return {
      description: '请按照具体步骤完成提现申请。',
      currentTab: 0,

      ///表单数据
      formData: {},

      // form
      form: null
    }
  },
  methods: {
    // handler
    nextStep(data) {
      //赋值
      if (data) this.formData = data

      if (this.currentTab < 2) {
        this.currentTab += 1
      }
    },
    prevStep() {
      if (this.currentTab > 0) {
        this.currentTab -= 1
      }
    },
    finish() {
      this.currentTab = 0
    }
  }
}
</script>

<style lang="scss" scoped>
.steps {
  max-width: 750px;
  margin: 16px auto;
}
</style>
